﻿using System;
using System.ComponentModel;
using System.Linq.Expressions;

public class ObservableObject : INotifyPropertyChanged
{
    protected void Notify(string propertyName)
    {
        var handler = PropertyChanged;
        if (handler != null) 
            handler(this, new PropertyChangedEventArgs(propertyName));
    }

    protected void Notify<T>(Expression<Func<T>> getExpression)
    {
        var body = getExpression.Body as MemberExpression;
        Notify(body.Member.Name);
    }

    public event PropertyChangedEventHandler PropertyChanged;
}

